package com.tengju.bff.interfaces.manage.login.assembler;

import com.tengju.bff.interfaces.app.user.vo.ManageUserVO;
import com.tengju.user.application.login.vo.LoginVO;
import com.tengju.user.domain.shared.AESUtil;
import com.tengju.user.domain.shared.Constant;

public class LoginAssembler {

    private LoginAssembler() {
    }

    public static ManageUserVO manageUserToVO(LoginVO manageUser) throws Exception {
        if (manageUser == null) {
            return null;
        }
        ManageUserVO manageUserVO = new ManageUserVO();
        manageUserVO.setAdminId(AESUtil.decrypt(Constant.USERID_ENCRYPT_KEY, manageUser.getUserId()));
        manageUserVO.setToken(manageUser.getToken());
        manageUserVO.setUsername(manageUser.getUsername());
        return manageUserVO;
    }
}
